import request from '@/utils/request'

/* 获取用户管理信息*/
export function getUserList(page, rows, args) {
    return request({
        url: '/api/UserInfoAction/getUserInfoList',
        method: 'get',
        params: { page, rows, ...args }
    })
}
/* 获取角色管理信息*/
export function getRoleList(page, rows, args) {
    return request({
        url: '/api/RoleManagerAction/getRoleListInfo',
        method: 'get',
        params: { page, rows, ...args }
    })
}
/* 获取数据监控信息*/
export function getDataMonitorList() {
    return request({
        url: '/api/',
        method: 'get'
    })
}

/* 新增用户*/
export function addUser(data) {
    return request({
        url: '/api/UserInfoAction/addUser',
        method: 'post',
        data
    })
}
/* 新增角色*/
export function addRole(data) {
    return request({
        url: '/api/RoleManagerAction/addRole',
        method: 'post',
        data
    })
}

/* 删除用户*/
export function deleteUser(id) {
    return request({
        url: '/api/UserInfoAction/deleteUser',
        method: 'get',
        params: { id }
    })
}
/* 删除角色*/
export function deleteRole(id) {
    return request({
        url: '/api/RoleManagerAction/deleteRole',
        method: 'get',
        params: { id }
    })
}

/* 修改用户*/
export function modifyUser(data) {
    return request({
        url: '/api/UserInfoAction/updateUserInfoBean',
        method: 'post',
        data
    })
}
/* 修改用户密码 */
export function modifyPassword(data) {
    return request({
        url: '/api/UserInfoAction/updatePassword',
        method: 'get',
        params: { ...data }
    })
}
/* 改变用户状态 */
export function modifyUserStatus(data) {
    return request({
        url: '/api/UserInfoAction/changeUserStatus',
        method: 'get',
        params: { ...data }
    })
}
/* 修改角色*/
export function modifyRole(data) {
    return request({
        url: '/api/RoleManagerAction/updateRoleInfo',
        method: 'post',
        data
    })
}
/* 改变角色状态 */
export function modifyRoleStatus(data) {
    return request({
        url: '/api/RoleManagerAction/changeRoleStatus',
        method: 'get',
        params: { ...data }
    })
}

/* 获取角色树形菜单*/
export function getRoleTree(roleId) {
    return request({
        url: '/api/MenuInfoAction/getMenusCheckForTree',
        method: 'post',
        params: { roleId }
    })
}

/* 提交树结构*/
export function postRoleTree(data) {
    return request({
        url: '/api/RoleManagerAction/updateRoleSourceInfo',
        method: 'post',
        params: data
    })
}

/* 校验用户名*/
export function validUser(roleName) {
    return request({
        url: '/api/RoleManagerAction/checkRoleName',
        method: 'post',
        params: { roleName }
    })
}
